package com.wsoft.bpm.listener.execute;

import com.wsoft.bpm.constants.BpmConstant;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 流程支持跳过
 *
 * @Author zhonglj
 * @Date 2024-09-23 15:43
 */
@Component("skipAbleListener")
public class SkipAbleListener implements ExecutionListener {

    @Override
    public void notify(DelegateExecution execution) {
        // 获取流程变量
        Map<String, Object> variables = execution.getVariables();
        // 开启支持跳过表达式
        variables.put(BpmConstant.SKIP_EXPRESSION, true);
        // 将修改同步到流程中
        execution.setTransientVariables(variables);
    }
}
